function* foo() {
    console.log("函数开始执行~")

    const value1 = 100 
    console.log("第一段代码",value1)
    yield

    const value2 = 200
    console.log("第二段代码",value2)
    yield

    const value3 = 200
    console.log("第三段代码",value3)
    yield

    console.log("函数结束执行~")
}

const generator = foo()
console.log(generator.next())
console.log(generator.next())
console.log(generator.next())
console.log(generator.next())
// generator.next()
// generator.next()
// generator.next()
// generator.next()
// 当遇到yield时候暂停函数的执行
// 当遇到return时候生成器就停止执行